package main

import "fmt"

//组合

type X3412 struct {
	a int
}

type Y3412 struct {
	X3412
	a int
}

type Z3412 struct {
	Y3412
	a int
}

func main() {
	x := X3412{
		a: 1,
	}

	y := Y3412{
		X3412: x,
		a:     2,
	}

	z := Z3412{
		Y3412: y,
		a:     3,
	}

	//z.a, z.Y3412.a, z.Y3412.X3412.a此时表示不同字段
	fmt.Println(z.a, z.Y3412.a, z.Y3412.X3412.a)
	z.a = 10
	z.Y3412.a = 20
	z.Y3412.X3412.a = 30
	fmt.Println(z.a, z.Y3412.a, z.Y3412.X3412.a)
}
